{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7e289859-f30b-40a2-aa4d-389066d0d5b2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "data = pd.read_csv('data.csv') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8e8241fe-e652-4ac8-9173-8591fda4f2a3",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.head()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d61921bd-0003-4066-a902-467feb82ed6b",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(type(data), data.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6100c7d6-4a3f-43c5-b8fc-d0730415169b",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = data.loc[:,'x']\n",
    "y = data.loc[:,'y']\n",
    "\n",
    "print(x,'\\n',y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f3dfcdcd-6090-48cf-92b4-fb0f43ce11af",
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib import pyplot as plt\n",
    "plt.figure(figsize=(5,5))\n",
    "plt.scatter(x,y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e3a58dac-2163-4892-a871-d577bd726837",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sklearn\n",
    "from sklearn.linear_model import  LinearRegression \n",
    "import numpy as np\n",
    "\n",
    "\n",
    "x = np.array(x)\n",
    "y = np.array(y)\n",
    "x = x.reshape(-1, 1)\n",
    "y = y.reshape(-1, 1)\n",
    "\n",
    "print(x.shape)\n",
    "print(y.shape)\n",
    "\n",
    "lr_model = LinearRegression()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8c99255d-14b8-440c-a630-234a8b801c61",
   "metadata": {},
   "outputs": [],
   "source": [
    "lr_model.fit(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3bfa2a21-1e69-4e37-8a6f-38c85d85d879",
   "metadata": {},
   "outputs": [],
   "source": [
    "y_predict = lr_model.predict(x+1)\n",
    "print(y_predict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "14502bb6-268f-40ea-8c09-a90c5fadba0f",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "188d9ab7-0f54-4c30-b610-5a2a45fcfbae",
   "metadata": {},
   "outputs": [],
   "source": [
    "y_ = lr_model.predict([[3.5]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "62a6beaf-6c46-4286-af9d-86b714474d91",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(y_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "136a23f7-c7f4-4cc0-a276-18cd9e07ea18",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3419074b-a122-4d5d-a292-afc6a3037cd7",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "95231964-b4af-4278-87b5-632ef51d9146",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "16da05e2-91ad-46d1-8bb2-7ed7a7083d0b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ece97f20-051b-414d-8028-ab88eae1228b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "05841588-505f-4af0-8162-5b3efbc91888",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "521d81c3-8454-4a40-836c-f11c47f1c776",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f6285f8c-4286-47aa-a803-8bf2f6b69402",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "83db3a60-3024-49a1-a25d-5bde4572bf27",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "988b44d3-e7b4-4262-9008-769e91b31b68",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ml",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
